using System;
using System.Data;
using System.Collections.Generic;
using Soccer.Core;
using Soccer.Utility;

namespace Soccer.Business
{
    [TableAttribute("NewsCategories")]
	[Serializable]
    public class NewsCategory : DBO<NewsCategory>
    {
		#region Fields
		
		private int? _Id;
		private int? _IdNews;
		private int? _IdCategory;
		
		#endregion
		
		#region Constructors
		/// <summary>
		/// Default constructor
		/// </summary>
		public NewsCategory()
		{
			
		}
		
		/// <summary>
		/// Constructor with Id 
		/// </summary>
		/// <param name="Id">The Id</param>
		public NewsCategory(int? Id )
		{
			this.Id = Id;
		}
		
		/// <summary>
		/// Constructor with all parameters
		/// </summary>
		/// <param name="Id">Sets int? value for Id</param>
		/// <param name="IdNews">Sets int? value for IdNews</param>
		/// <param name="IdCategory">Sets int? value for IdCategory</param>
		public NewsCategory(int? id, int? idNews, int? idCategory)
		{
			this.Id = id;
			this.IdNews = idNews;
			this.IdCategory = idCategory;
		}
		
		#endregion
		
		#region Properties
		
		/// <summary>
		/// Gets or sets int? value for Id
		/// </summary>
		[ColumnAttribute("Id", SqlDbType.Int , 4 , true, true, false)]
		public int? Id
		{
			set
			{
				this._Id = value;
			}
			get
			{
				return this._Id;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdNews
		/// </summary>
		[ColumnAttribute("IdNews", SqlDbType.Int , 4 , false, false, true)]
		public int? IdNews
		{
			set
			{
				this._IdNews = value;
			}
			get
			{
				return this._IdNews;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdCategory
		/// </summary>
		[ColumnAttribute("IdCategory", SqlDbType.Int , 4 , false, false, true)]
		public int? IdCategory
		{
			set
			{
				this._IdCategory = value;
			}
			get
			{
				return this._IdCategory;
			}
		}
		
		
		/// <summary>
		/// Get a Category of current NewsCategory object base on IdCategory
		/// </summary>
		public Category Category
		{
			get
			{
				if (this.IdCategory == null)
					return null;
	
				Category condition = new Category(this.IdCategory);
				return CategoryController.FindItem(condition);
			}
		}
		
		/// <summary>
		/// Get a Newse of current NewsCategory object base on IdNews
		/// </summary>
		public Newse News
		{
			get
			{
				if (this.IdNews == null)
					return null;
	
				Newse condition = new Newse(this.IdNews);
				return NewseController.FindItem(condition);
			}
		}
		
		#endregion
        
        #region Other Properties
        private static ColumnNameStruct? _ColumnName;
        public static ColumnNameStruct ColumnName
        {
            get
            {
                if (!_ColumnName.HasValue)
                    _ColumnName = new ColumnNameStruct();
                return _ColumnName.Value;
            }
        }
        #endregion

        #region NestedType
        public  struct ColumnNameStruct
        {
            /// <summary>
            /// Get the name of column [Id]
            /// </summary>
            public string Id
            {
                get
                {
                    return "Id";
                }
            }
            /// <summary>
            /// Get the name of column [IdNews]
            /// </summary>
            public string IdNews
            {
                get
                {
                    return "IdNews";
                }
            }
            /// <summary>
            /// Get the name of column [IdCategory]
            /// </summary>
            public string IdCategory
            {
                get
                {
                    return "IdCategory";
                }
            }
        }
        #endregion
    }
}
